package com.Algorithm.HUAWEI.four20220505;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/05/05/17:29
 * @Description:
 * @Target:
 */
public class 查找输入整数二进制中1的个数 {


    public static void main(String[] args) throws IOException {
/*        for (int i = 0; i < 1000; i++) {
            if (!getErJingZhi(i).equals(Integer.toBinaryString(i))){
                System.out.println(getErJingZhi(0));
                System.out.println(i);
            }
        }*/

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String num;
        while ((num = in.readLine()) != null){
            System.out.println(getErJingZhi(Integer.valueOf(num)));
        }
    }

    // 正常整数变二进制
    static int getErJingZhi(int num){
       int count = 0;
        while (num>0){
            if (num%2==1){
                count++;
            }
            num/=2;
        }
        return count;
    }
}
